package cn.pconline.autoclub.entity;

import java.util.Date;

import org.gelivable.dao.Column;
import org.gelivable.dao.Entity;
import org.gelivable.dao.Id;
import org.gelivable.dao.Label;

import cn.pconline.autoclub.util.EncodeUtils;

import com.alibaba.fastjson.JSONObject;

/**
 * @author zhouruxuan
 * @date 2015年2月27日 下午2:55:10
 */
@Entity(tableName = "ac_photo_reply", 
logChange = true, split = "Mod:photoId:10")
@Label("照片回复")
public class PhotoReply {

	@Id
    @Label("回复id")
    @Column(name = "photo_reply_id")
    private long photoReplyId;
	
	@Label("照片id")
    @Column(name = "photo_id")
    private long photoId;
	
	@Label("相册id")
    @Column(name = "album_id")
    private long albumId;
	
	@Label("评论内容")
    @Column(name = "content")
    private String content;
	
	@Label("评论时间")
    @Column(name = "create_at")
    private Date createAt;
	
	@Label("评论者id")
    @Column(name = "create_by")
    private long createBy;
	
	@Label("被回复的评论id")
	@Column(name = "post_to_photo_relpy_id")
	private long postToPhontoReplyId;
	
	@Label("被回复的评论用户id")
	@Column(name = "post_to_user_id")
	private long postToUserId;
	
	@Label("评论状态")
	@Column(name = "status")
	private int status;
	
	public static final int STATUS_NORMAL = 1;//正常
	public static final int STATUS_DELETE = -1;//删除
	
	
	public long getPhotoReplyId() {
		return photoReplyId;
	}

	public void setPhotoReplyId(long photoReplyId) {
		this.photoReplyId = photoReplyId;
	}

	public long getPhotoId() {
		return photoId;
	}

	public void setPhotoId(long photoId) {
		this.photoId = photoId;
	}

	public long getAlbumId() {
		return albumId;
	}

	public void setAlbumId(long albumId) {
		this.albumId = albumId;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public Date getCreateAt() {
		return createAt;
	}

	public void setCreateAt(Date createAt) {
		this.createAt = createAt;
	}

	public long getCreateBy() {
		return createBy;
	}

	public void setCreateBy(long createBy) {
		this.createBy = createBy;
	}

	public long getPostToPhontoReplyId() {
		return postToPhontoReplyId;
	}

	public void setPostToPhontoReplyId(long postToPhontoReplyId) {
		this.postToPhontoReplyId = postToPhontoReplyId;
	}

	public long getPostToUserId() {
		return postToUserId;
	}

	public void setPostToUserId(long postToUserId) {
		this.postToUserId = postToUserId;
	}

	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}
	
	public JSONObject toJson() {
		JSONObject jsonObject = new JSONObject();
		jsonObject.put("photoId", getPhotoId());
		jsonObject.put("albumId", getAlbumId());
		jsonObject.put("photoReplyId", getPhotoReplyId());
		jsonObject.put("content", getContent());
		jsonObject.put("createAt", getCreateAt());
		jsonObject.put("createBy", getCreateBy());
		jsonObject.put("postToPhotoReplyId", getPostToPhontoReplyId());
		jsonObject.put("postToUserId", getPostToUserId());
		return jsonObject;
	}
	
	public JSONObject toJsonEncodeHtml() {
		JSONObject jsonObject = toJson();
		jsonObject.put("content", EncodeUtils.encodeForHTMLFilterNull(getContent()));
		return jsonObject;
	}
}
